home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / tchk21ex.zip / DEMONUM.C < prev    next >
C/C++ Source or Header  |  1989-06-06  |  1KB  |  35 lines

  1. /* TCHK 2.1 - Howard Kapustein's Turbo C library        6-6-89      */
  2. /* Copyright (C) 1988,1989 Howard Kapustein.  All rights reserved.  */
  3.  
  4. /* demonum.c  -  used for testing TCHK number (math/accounting) functions */
  5.  
  6. #include <howard.h>
  7. #include  <mathhk.h>
  8. #include <finance.h>
  9. #include <stdio.h>
  10. #include <dos.h>             /* for argc/argv */
  11.  
  12. void main();
  13.  
  14. void main()
  15. {
  16.     extern int _argc;
  17.     extern char **_argv;
  18.     double d=123456.78901, cost=10000.0, salvage=4000.0;
  19.     int i=2, life=10, period=_argc;
  20.  
  21.     printf("round %lf to %d places: %lf\n",d,i,round(d,i));
  22.     printf("frac %lf: %lf\n\n",d,frac(d));
  23.  
  24.     printf("Cost: %lf    Salvage: %lf    Life: %d    Period: %d\n\n",cost,salvage,life,period);
  25.     printf("straight line: %lf\n",SLD(cost,salvage,life));
  26.     printf("sum year digits: %lf\n",SYD(cost,salvage,life,period));
  27.     printf("double decline: %lf\n",DDB(cost,life,period));
  28.     printf("Dep 1: %lf\n",depreciation(cost,salvage,life,period,1));
  29.     printf("Dep 2: %lf\n",depreciation(cost,salvage,life,period,2));
  30.     printf("Dep 3: %lf\n\n",depreciation(cost,salvage,life,period,3));
  31.     printf("Accum Dep 1: %lf\n",accum_dep(cost,salvage,life,period+1,1));
  32.     printf("Accum Dep 2: %lf\n",accum_dep(cost,salvage,life,period+1,2));
  33.     printf("Accum Dep 3: %lf\n",accum_dep(cost,salvage,life,period+1,3));
  34. }
  35.